using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableUnionFightGuardDao:DaoBase<TableUnionFightGuard>
    {
        public override void AddPrimaryIndex(TableUnionFightGuard model)
        {
            cachePrimary[model.UFGuardId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableUnionFightGuard.txt";
        }

        protected override TableUnionFightGuard ParseRowData(string[] rowData)
        {
            TableUnionFightGuard data = new TableUnionFightGuard();
			data.UFGuardId = rowData [0];
			data.ModelName = rowData [1];

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.ModelScale = 0;
            }
            else
            {
                data.ModelScale = double.Parse(rowData[2]);
            }
			data.IconRes = rowData [3];
			data.WeaponId = rowData [4];

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.Height = 0;
            }
            else
            {
                data.Height = double.Parse(rowData[5]);
            }
			data.GuardName = rowData [6];
			data.Position = rowData [7];

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.WanderR = 0;
            }
            else
            {
                data.WanderR = double.Parse(rowData[8]);
            }

            if (string.IsNullOrEmpty(rowData[9]))
            {
                data.WanderSpeed = 0;
            }
            else
            {
                data.WanderSpeed = double.Parse(rowData[9]);
            }

            if (string.IsNullOrEmpty(rowData[10]))
            {
                data.WanderRestTime = 0;
            }
            else
            {
                data.WanderRestTime = double.Parse(rowData[10]);
            }

            if (string.IsNullOrEmpty(rowData[11]))
            {
                data.AlertR = 0;
            }
            else
            {
                data.AlertR = double.Parse(rowData[11]);
            }

            if (string.IsNullOrEmpty(rowData[12]))
            {
                data.PursureR = 0;
            }
            else
            {
                data.PursureR = double.Parse(rowData[12]);
            }

            if (string.IsNullOrEmpty(rowData[13]))
            {
                data.PursureSpeed = 0;
            }
            else
            {
                data.PursureSpeed = double.Parse(rowData[13]);
            }

            if (string.IsNullOrEmpty(rowData[14]))
            {
                data.ReturnSpeed = 0;
            }
            else
            {
                data.ReturnSpeed = double.Parse(rowData[14]);
            }

            if (string.IsNullOrEmpty(rowData[15]))
            {
                data.Angle = 0;
            }
            else
            {
                data.Angle = double.Parse(rowData[15]);
            }

            if (string.IsNullOrEmpty(rowData[16]))
            {
                data.Range = 0;
            }
            else
            {
                data.Range = double.Parse(rowData[16]);
            }
			data.Say = rowData [17];

            return data;
        }



    }

}
